<?php
session_start(); //Do not remove this
    if (!isset($_SESSION['login'])){$_SESSION['login']='';}


	
?>
<!doctype html>
<html>
	<head>
		<title>Admin control panel</title>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" href="css/admin.css" media="all">
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
	</head>
<body>
	<div id="login_div" class="container">
		<div class="login">
			<label for="file">Username:</label><input type="text" name="username" id="username"><br>
			<label for="file">Password:</label><input type="password" name="password" id="password" onkeypress="loginfx()"><br>
			<input id="login_submit" type="submit" value="Login">
		</div>
	</div>
	<script>
	$(document).ready(function(){
		$('#username').focus();
	});
		
		$('#login_submit').click(function(){
			loginfx();
		});
		function loginfx(){
			var username = $('#username').val();
			var password = $('#password').val();
			//alert (username);
			//alert (' login clicked');
			$.post('checklogin.php',{username:username, password: password}, function(data){
				//alert (data);
				if (data=='logged in'){
					window.location.href='main.php';
				}
			});
		}
	</script>
</body>
</html>